#pragma once

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef enum {NULL_RESULT, ILLEGAL_ID, NO_SUCH_ENTITY_TYPE, NO_SUCH_ENTITY, ACCESS_ERROR, SUCCESS} DALResultMessage;

typedef char* String;

typedef struct
{
	String* Entities;
	unsigned int Size;
} EntityTable;

typedef struct
{
	char* Data;
	unsigned int Bytes;
} DataEntity;

typedef struct
{
	DALResultMessage Message;
	DataEntity Result;
} DALResult;

//Environment global variables
String EnvironmentDirectoryPath;
EntityTable EnvironmentEntityTable;

//EntityTable.c
EntityTable CreateEntityTable(const String* Entities, unsigned int Size);
void DestructEntityTable(EntityTable EntityTable);

//DataEnvironment.c
int EstablishDataEnvironment(String DirectoryPath, EntityTable EntityTable);
void DestructDataEnvironment();

//EntityAccess.c
DALResult CreateOrEditEntity(String EntityType, unsigned int ID, DataEntity DEntity);
DALResult GetEntity(String EntityType, unsigned int ID);
DALResult DeleteEntity(String EntityType, unsigned int ID);

//DAL.c
void DestructDALResult(DALResult* DR);